<?php

use think\migration\Migrator;
use think\migration\db\Column;

class BasicIndustry extends Migrator
{
    public function up()
    {
        $table = $this->table('basic_industry');
        $table
            //step1:名称
            ->addColumn('name', 'string', ['limit' => 50, 'default' => '', 'comment' => '行业名称'])
            ->addColumn('english_name', 'string', ['limit' => 50, 'default' => '', 'comment' => '行业简称'])
            ->addColumn('pinyin_name', 'string', ['limit' => 50, 'default' => '', 'comment' => '拼音简称'])
            ->addColumn('type', 'integer', ['limit' => 2, 'default' => '0', 'comment' => '行业类型1工业2非工业'])
            ->addColumn('type_detail', 'string', ['limit' => 50, 'default' => '', 'comment' => '行业类型说明'])
            ->addColumn('delete_time', 'integer', ['limit' => 11, 'default' => 0, 'comment'=>'软删除'])

            //主键
            ->addIndex(['name'])

            //注释
            ->setComment('基本信息 - 行业')

            //引擎
            ->setEngine('InnoDB')
            ->save();
    }

    public function down()
    {
        $this->table('basic_industry')->drop();
    }
}
